package com.yidiandao.business.ui.shop;

import android.app.Activity;
import android.content.Intent;

import com.yidiandao.business.R;
import com.yidiandao.business.base.BaseActivity;
import com.yidiandao.business.data.model.ShopModel;
import com.yidiandao.business.utils.ActivityUtils;

/** 店铺列表Activity. */
public class ShopActivity extends BaseActivity {

    private ShopFragment shopFragment;

    public static void actionStart(Activity activity) {
        Intent intent = new Intent(activity, ShopActivity.class);
        activity.startActivity(intent);
    }

    @Override
    protected void initFragment() {
        shopFragment =
                (ShopFragment) getSupportFragmentManager().findFragmentById(R.id.container_shop);

        if (shopFragment == null) {
            shopFragment = ShopFragment.getInstance();
            ActivityUtils.addFragmentToActivity(
                    getSupportFragmentManager(), shopFragment, R.id.container_shop);
        }
    }

    @Override
    protected void initPresenter() {
        new ShopPresenter(shopFragment, new ShopModel());
    }

    @Override
    protected int getLayoutId() {
        return R.layout.activity_shop;
    }
}
